class Stack:
    def __init__(self):
        self.stack = []

    def push(self,element):
        self.stack.append(element)

    def pop(self):
        if not self.is_empty():
            return self.stack.pop()
        else:
            return None
    
    def get_top(self):
        if self.stack:
            return self.stack[-1] # 取栈顶元素
        else:
            return None   
    def is_empty(self):
        return len(self.stack) == 0

def check_brackets_match(expression):
    stack = Stack()
    expression = expression.split("@")[0]
    for char in expression:
        if char == "(":
            stack.push(char)
        if char == ")":
            if stack.is_empty():  # 如果栈为空，则括号不匹配
                print("NO")
                return None
            else:
                stack.pop() # 弹出栈顶元素(左括号)
    if stack.is_empty():
        print("YES")
    else:
        print("NO")

expression = input()
check_brackets_match(expression)
    